package cn.itcast.bos.services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.domain.User;
import cn.itcast.bos.utils.MD5Utils;
import cn.itcast.dao.base.IUserDao;

@Service
@Transactional
public class UserServiceImpl implements IUserService {
	@Autowired
	private IUserDao userDao;

	@Override
	public User login(User user) {
		if(user == null) {
			return null;
		}
		String username = user.getUsername();
		String password = user.getPassword();
		password = MD5Utils.md5(password);
		return userDao.findByUserNameAndPassword(username, password);
	}

}
